package top.whq6.study.dao.impl;

import lombok.extern.slf4j.Slf4j;
import top.whq6.study.dao.CacheInfo;
import top.whq6.study.dao.LessonDao;
import top.whq6.study.entity.Lesson;

@Slf4j
public class LessonDaoImpl implements LessonDao {

  @Override
  public void addLesson(Lesson l) {
    log.info("Add Lesson: {}", l);
    CacheInfo.LESSON_CACHE.put(l.getId(), l);
  }

  @Override
  public void delLesson(int lId) {
    log.info("Delete Lesson id: {}", lId);
    CacheInfo.LESSON_CACHE.remove(lId);
    log.info("Delete Lesson Success");

  }

  @Override
  public void modLesson(Lesson l) {
    log.info("Modify Lesson info: {}", l);
    CacheInfo.LESSON_CACHE.put(l.getId(), l);
    log.info("Modify Lesson Success");
  }
}
